﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TpBaseObjects.Base;

namespace TpBaseObjects.Objects {

    public class CustomerSourceObj : MyBaseModel, IEquatable<CustomerSourceObj>, IComparable<CustomerSourceObj> {

        #region Members

        private int customerSourceID;
        private string customerSourceShort;
        private string customerSourceLong;

        #endregion

        #region Constructor

        public CustomerSourceObj() {
        }

        #endregion

        #region Properties

        public int CustomerSourceID {
            get { return this.customerSourceID; }
            set {
                if (this.customerSourceID == value) {
                    return;
                }
                this.customerSourceID = value;
                OnPropertyChanged(() => CustomerSourceID);
            }
        }

        public string CustomerSourceShort {
            get { return this.customerSourceShort; }
            set {
                if (this.customerSourceShort == value) {
                    return;
                }
                this.customerSourceShort = value;
                OnPropertyChanged(() => CustomerSourceShort);
            }
        }

        public string CustomerSourceLong {
            get { return this.customerSourceLong; }
            set {
                if (this.customerSourceLong == value) {
                    return;
                }
                this.customerSourceLong = value;
                OnPropertyChanged(() => CustomerSourceLong);
            }
        }

        #endregion

        #region Functions

        public int CompareTo(CustomerSourceObj comparePart) {
            // A null value means that this object is greater.
            if (comparePart == null)
                return 1;

            else
                return this.CustomerSourceID.CompareTo(comparePart.CustomerSourceID);
        }

        public bool Equals(CustomerSourceObj other) {
            if (other == null) return false;
            return (this.CustomerSourceID.Equals(other.CustomerSourceID));
        }

        #endregion

        #region Overide

        public override bool Equals(object obj) {
            if (obj == null) return false;
            CustomerSourceObj objAsPart = obj as CustomerSourceObj;
            if (objAsPart == null) return false;
            else return Equals(objAsPart);
        }

        public override int GetHashCode() {
            return this.CustomerSourceID;
        }

        public override string ToString() {
            return "ID: " + this.CustomerSourceID.ToString() + "   Name: " + this.CustomerSourceShort;
        }

        #endregion
        
    }
}
